package com.tmxk.day01.lifeng.demo3;

import java.util.Scanner;

/**
 * 定义静态特征(属性),name,password
 *针对密码属性进行逻辑判断(密码正确,更改;密码不正确,警告)
 */
public class User {
	String name = "admin1";
	String password = "111111";
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public String getPassword() {
		return password;
	}
	public void setPassword(String password) {
		this.password = password;
	}
	public void consistent(String name,String password) {
		String user_name = getName();
		String old_password = getPassword();
		if(name.equals(user_name)) {
			if(password.equals(old_password)) {
				update_Password();
			}else {
				System.out.println("密码错误!您没有更新的权限");
			}
		}else {
			System.out.println("用户名错误!您没有更新的权限");
		}
	}
	public void update_Password() {
		Scanner up = new Scanner(System.in);
		System.out.println("请输入新的密码");
		this.password = up.nextLine();
		System.out.println("修改密码成功,您的新密码为:" +this.password);
	}
	
}
